using System;
using System.Collections;
using System.Collections.Generic;
using HR60_PanelSoft.Model.BaseModel;

namespace HR60_PanelSoft.Model
{
    //GC: [g1]修正加载bug
    //GC: [g2]增加新架构辅助函数
    
	/// <summary>
	/// 可控属性
	/// </summary>
	public class CtrlAttr : RefModel
	{
		/// <summary>
		/// 名称
		/// </summary>
		public string name = null;

		/// <summary>
		/// 协议标识
		/// </summary>
		public string protocolTag = null;


        /* [g1.s1] */
		/// <summary>
		/// 取值列表，key为显示名称，value为协议标识
		/// </summary>
		//public IDictionary values = new Dictionary<string, object>();
        public Dictionary<string, object> values = new Dictionary<string, object>();
        /* end of [g1.s1] */

        /*[g2.s1]*/
        public string GetKeybyValue(object value)
        {
            string rst = string.Empty;
            foreach (KeyValuePair<string, object> k in values)
            {
                //if (k.Value.ToString() == value.ToString())
                if(k.Value.Equals(value))
                {
                    return k.Key;
                }
            }
            return rst;
        }
        /* end of [g2.s1] */
	}
}

